package red.lsk.business.service.impl;

import java.util.List;

import cn.hutool.core.util.IdUtil;
import red.lsk.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import red.lsk.business.mapper.BizTransactionRecordsMapper;
import red.lsk.business.domain.BizTransactionRecords;
import red.lsk.business.service.IBizTransactionRecordsService;
import red.lsk.common.core.text.Convert;

/**
 * 消费记录Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-05-09
 */
@Service
public class BizTransactionRecordsServiceImpl implements IBizTransactionRecordsService 
{
    @Autowired
    private BizTransactionRecordsMapper bizTransactionRecordsMapper;

    /**
     * 查询消费记录
     * 
     * @param id 消费记录主键
     * @return 消费记录
     */
    @Override
    public BizTransactionRecords selectBizTransactionRecordsById(String id)
    {
        return bizTransactionRecordsMapper.selectBizTransactionRecordsById(id);
    }

    /**
     * 查询消费记录列表
     * 
     * @param bizTransactionRecords 消费记录
     * @return 消费记录
     */
    @Override
    public List<BizTransactionRecords> selectBizTransactionRecordsList(BizTransactionRecords bizTransactionRecords)
    {
        return bizTransactionRecordsMapper.selectBizTransactionRecordsList(bizTransactionRecords);
    }

    /**
     * 新增消费记录
     * 
     * @param bizTransactionRecords 消费记录
     * @return 结果
     */
    @Override
    public int insertBizTransactionRecords(BizTransactionRecords bizTransactionRecords)
    {
        String idStr = IdUtil.getSnowflake(1, 1).nextIdStr();
        bizTransactionRecords.setId(idStr);
        bizTransactionRecords.setCreateTime(DateUtils.getNowDate());
        return bizTransactionRecordsMapper.insertBizTransactionRecords(bizTransactionRecords);
    }

    /**
     * 修改消费记录
     * 
     * @param bizTransactionRecords 消费记录
     * @return 结果
     */
    @Override
    public int updateBizTransactionRecords(BizTransactionRecords bizTransactionRecords)
    {
        bizTransactionRecords.setUpdateTime(DateUtils.getNowDate());
        return bizTransactionRecordsMapper.updateBizTransactionRecords(bizTransactionRecords);
    }

    /**
     * 批量删除消费记录
     * 
     * @param ids 需要删除的消费记录主键
     * @return 结果
     */
    @Override
    public int deleteBizTransactionRecordsByIds(String ids)
    {
        return bizTransactionRecordsMapper.deleteBizTransactionRecordsByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除消费记录信息
     * 
     * @param id 消费记录主键
     * @return 结果
     */
    @Override
    public int deleteBizTransactionRecordsById(String id)
    {
        return bizTransactionRecordsMapper.deleteBizTransactionRecordsById(id);
    }
}
